<include file="common/hearder"/>

<form method="post" enctype="multipart/form-data" style="width: 350px;float: left" >
    <div class="form-group">
        <label for="event">名称:</label>
        <input type="text" class="form-control" id="event" name="event" placeholder="请输入薪酬管理名称" value="">
    </div>
    <div class="form-group">
        <label for="entry_person">录入人:</label>
        <input type="text" class="form-control" id="entry_person" name="entry_person" placeholder="请输入录入人名字" value="">
    </div>
    <div class="form-group">
        <label for="explain">录入说明:</label>
        <input type="text" class="form-control" id="explain" name="explain" placeholder="请输入录入说明">
    </div>
    <div class="form-group">
        <label for="entry_time">录入时间:</label>
        <input type="text" class="form-control" id="entry_time" name="entry_time" value="{$data.time|default=time()|date='Y-m-d H:i:s',###}" readonly>
    </div>
<table border="1px">
    <thead>
    <tr>
    <th>序号</th>
    <th>用户名</th>
    <th>岗位补贴</th>
    <th>职位工资</th>
    <th>奖励金额</th>
        <th>惩罚金额</th>
    <th>实际应得工资</th>
    </tr>
    </thead>
    <foreach name="staffinfo" item="sta">
    <tbody>
    <tr class="trqian">
        <th><input type="hidden" id="id" name="id" value="<?php echo $sta['stf_id']?>">
          {$sta.stf_id}</th>
        <th>{$sta.stf_name}</th>
        <th>
            <input type="text" style="width: 100px" name="gw" id="gw" value="<?php echo $postinfo[$sta['pt_id']]['subsidy']?>">
        </th>
        <th>
            <input type="text" style="width: 100px" name="zw" id="zw" value="<?php echo $postinfo[$sta['pt_id']]['wages']?>" readonly>
        </th>
        <th>
            <input type="text" style="width: 100px" name="cf" value="">
        </th>
        <th>
            <input type="text" style="width: 100px" name="rewards" id="rewards">
        </th>
        <th>
            <input type="text" style="width: 100px" name="xj" id="xj" value="" readonly>
        </th>
    </tr>
    </tbody>
    </foreach>
</table>

    <input type="hidden" value="1" name="hidden">
    <button type="submit" class="btn btn-default">确定</button>
</form>
<script>
    $(function(){
        $('.trqian input').bind('input propertychange', function() {
            var xj=0;
            var gw=$(this).parents('.trqian').children('th').children('input[name="gw"]').val();
            var zw=$(this).parents('.trqian').children('th').children('input[name="zw"]').val();
            var cf=$(this).parents('.trqian').children('th').children('input[name="cf"]').val();
            var rewards=$(this).parents('.trqian').children('th').children('input[name="rewards"]').val();
            if (parseInt(gw)){
                xj+=parseInt(gw);
            }
            if (parseInt(zw)){
                xj+=parseInt(zw);
            }
            if (parseInt(rewards)){
                xj-=parseInt(rewards);
            }
            if(parseInt(cf)){
                xj+=parseInt(cf);
            }
            var xj=$(this).parents('.trqian').children('th').children('input[name="xj"]').val(xj);
        });

    })
</script>
<include file="common/footer"/>